package com.zju.DoctorGo.entity;

import com.zju.DoctorGo.dto.BillDTO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.math.BigDecimal;
import java.sql.Timestamp;


@Data
@TableName("bill")
public class Bill {

    /**
     * 订单ID，由支付宝生成
     */
    @TableId(value = "billId", type = IdType.INPUT)
    private String billId;

    @TableField("paymentPartyId")
    private Integer paymentPartyId;

    @TableField("paymentPartyName")
    private String paymentPartyName;

    @TableField("initiatorId")
    private Integer initiatorId;

    @TableField("initiatorName")
    private String initiatorName;

    @TableField("amount")
    private BigDecimal amount;

    @TableField("timestamp")
    private Timestamp timestamp;

    @TableField("paymentStatus")
    private PaymentStatusEnum paymentStatus;

    @TableField("diagnosisId")
    private Integer diagnosisId;

    // 全参数构造函数
    public Bill(String billId, Integer paymentPartyId, String paymentPartyName, Integer initiatorId, String initiatorName, BigDecimal amount, Timestamp timestamp, PaymentStatusEnum paymentStatus, Integer diagnosisId) {
        this.billId = billId;
        this.paymentPartyId = paymentPartyId;
        this.paymentPartyName = paymentPartyName;
        this.initiatorId = initiatorId;
        this.initiatorName = initiatorName;
        this.amount = amount;
        this.timestamp = timestamp;
        this.paymentStatus = paymentStatus;
        this.diagnosisId = diagnosisId;
    }

    public Bill(BillDTO billDto) {
        this.billId = billDto.getBillId();
        this.paymentPartyId = billDto.getPaymentPartyId();
        this.paymentPartyName = billDto.getPaymentPartyName();
        this.initiatorId = billDto.getInitiatorId();
        this.initiatorName = billDto.getInitiatorName();
        this.amount = billDto.getAmount();
        this.timestamp = new Timestamp(System.currentTimeMillis());
        this.paymentStatus = PaymentStatusEnum.PENDING;
        this.diagnosisId = billDto.getDiagnosisId();
    }
    // Setter Methods (If you still need to manually define them)
    public void setBillId(String billId) {
        this.billId = billId;
    }

    public void setPaymentPartyId(Integer paymentPartyId) {
        this.paymentPartyId = paymentPartyId;
    }

    public void setPaymentPartyName(String paymentPartyName) {
        this.paymentPartyName = paymentPartyName;
    }

    public void setInitiatorId(Integer initiatorId) {
        this.initiatorId = initiatorId;
    }

    public void setInitiatorName(String initiatorName) {
        this.initiatorName = initiatorName;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public void setTimestamp(Timestamp timestamp) {
        this.timestamp = timestamp;
    }

    public void setPaymentStatus(PaymentStatusEnum paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public void setDiagnosisId(Integer diagnosisId) {
        this.diagnosisId = diagnosisId;
    }
}
